using System;
using Newtonsoft.Json;

namespace FBGraph.Models
{
    /// <summary>An individual photo</summary>
    /// <remarks>
    /// <para>Example: https://graph.facebook.com/98423808305 (A photo from the Coke fan page)</para>
    /// </remarks>
    public partial class Photo : IFBGraphResult
    {
        /// <summary>The photo ID</summary>
        [JsonPropertyAttribute("id")]
        public Int64 Id { get; set; }
        
        /// <summary>An object containing the name and ID of the user who posted the photo</summary>
        [JsonPropertyAttribute("from")]
        public From From { get; set; }
        
        /// <summary>An array containing the users and their positions in this photo.  The x and y coordinates are percentages from the left and top edges of the photo, respectively.</summary>
        [JsonPropertyAttribute("tags")]
        public PagedResult<PhotoTag> Tags { get; set; }
        
        /// <summary>The caption given to this photo</summary>
        [JsonPropertyAttribute("name")]
        public String Name { get; set; }
        
        /// <summary>The album-sized view of the photo</summary>
        [JsonPropertyAttribute("picture")]
        public String Picture { get; set; }
        
        /// <summary>The  full-sized source of the photo</summary>
        [JsonPropertyAttribute("source")]
        public String Source { get; set; }
        
        /// <summary>The height of the photo, in pixels</summary>
        [JsonPropertyAttribute("height")]
        public Int64 Height { get; set; }
        
        /// <summary>The width of the photo, in pixels</summary>
        [JsonPropertyAttribute("width")]
        public Int64 Width { get; set; }
        
        /// <summary>A link to the photo on Facebook</summary>
        [JsonPropertyAttribute("link")]
        public String Link { get; set; }
        
        /// <summary>A URL for an icon representing the photo</summary><remarks>The icon appears to be 16x16 or smaller, similar to a favicon.</remarks>
        [JsonPropertyAttribute("icon")]
        public String Icon { get; set; }
        
        /// <summary>The time the photo was initially published</summary>
        [JsonPropertyAttribute("created_time")]
        public DateTime CreatedTime { get; set; }
        
        /// <summary>The last time the photo or its caption was updated</summary>
        [JsonPropertyAttribute("updated_time")]
        public DateTime UpdatedTime { get; set; }
        
        /// <summary>Gets or sets a <see cref="Boolean" /> value representing whether the object has been populated.</summary>
        Boolean IFBGraphResult.IsReady { get; set; }
        
        /// <summary>Updates the current model with values from another like-typed model.</summary>
        /// <param name="other">The source model.</param>
        /// <remarks>This is used for asynchronous calls to update the reference that was returned when the original API method was called.</remarks>
        void IFBGraphResult.UpdateFrom(IFBGraphResult other)
        {
            var that = other as Photo;
            if (that == null) return;
            else
            {
                this.Id = that.Id;
                this.From = that.From;
                this.Tags = that.Tags;
                this.Name = that.Name;
                this.Picture = that.Picture;
                this.Source = that.Source;
                this.Height = that.Height;
                this.Width = that.Width;
                this.Link = that.Link;
                this.Icon = that.Icon;
                this.CreatedTime = that.CreatedTime;
                this.UpdatedTime = that.UpdatedTime;
                ((IFBGraphResult)this).IsReady = true;
            }
            
        }
        
        /// <summary>Contains information about a user that was tagged in a photo</summary>
        public partial class PhotoTag
        {
            /// <summary>The Graph API id of the user that was tagged the photo</summary>
            [JsonPropertyAttribute("id")]
            public Nullable<Int64> Id { get; set; }
            
            /// <summary>The name of the user that was tagged in the photo</summary>
            [JsonPropertyAttribute("name")]
            public String Name { get; set; }
            
            /// <summary>The Y coordinate of the tag in the photo</summary>
            [JsonPropertyAttribute("y")]
            public Decimal Y { get; set; }
            
            /// <summary>The date and time the user was tagged</summary>
            [JsonPropertyAttribute("created_time")]
            public DateTime CreatedTime { get; set; }
            
            /// <summary>The X coordinate of the tag in the photo</summary>
            [JsonPropertyAttribute("x")]
            public Decimal X { get; set; }
        }
    }
}